From: Andres Lagar-Cavilla Date: Tue, 6 Dec 2011 20:10:32 +0000 (+0000) Subject: x86/mm: Allow memevent responses to be signaled via the event channel X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=f8c8aa3f171af6074f11310a17dce800ae0b4720;p=xen.git x86/mm: Allow memevent responses to be signaled via the event channel Don't require a separate domctl to notify the memevent interface that an event has occured. This domctl can be taxing, particularly when you are scaling events and paging to many domains across a single system. Instead, we use the existing event channel to signal when we place something in the ring (as per normal ring operation). Signed-off-by: Adin Scannell Signed-off-by: Keir Fraser Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/mem_event.c b/xen/arch/x86/mm/mem_event.c index b041744965..48ac47d4ab 100644 --- a/xen/arch/x86/mm/mem_event.c +++ b/xen/arch/x86/mm/mem_event.c @@ -37,9 +37,11 @@ #define mem_event_ring_lock(_med) spin_lock(&(_med)->ring_lock) #define mem_event_ring_unlock(_med) spin_unlock(&(_med)->ring_lock) -static int mem_event_enable(struct domain *d, - xen_domctl_mem_event_op_t *mec, - struct mem_event_domain *med) +static int mem_event_enable( + struct domain *d, + xen_domctl_mem_event_op_t *mec, + struct mem_event_domain *med, + xen_event_channel_notification_t notification_fn) { int rc; struct domain *dom_mem_event = current->domain; @@ -94,7 +96,7 @@ static int mem_event_enable(struct domain *d, /* Allocate event channel */ rc = alloc_unbound_xen_event_channel(d->vcpu[0], current->domain->domain_id, - NULL); + notification_fn); if ( rc < 0 ) goto err; @@ -233,6 +235,18 @@ int mem_event_check_ring(struct domain *d, struct mem_event_domain *med) return ring_full; } +/* Registered with Xen-bound event channel for incoming notifications. */ +static void mem_paging_notification(struct vcpu *v, unsigned int port) +{ + p2m_mem_paging_resume(v->domain); +} + +/* Registered with Xen-bound event channel for incoming notifications. */ +static void mem_access_notification(struct vcpu *v, unsigned int port) +{ + p2m_mem_access_resume(v->domain); +} + int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, XEN_GUEST_HANDLE(void) u_domctl) { @@ -294,7 +308,7 @@ int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, if ( p2m->pod.entry_count ) break; - rc = mem_event_enable(d, mec, med); + rc = mem_event_enable(d, mec, med, mem_paging_notification); } break; @@ -333,7 +347,7 @@ int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) break; - rc = mem_event_enable(d, mec, med); + rc = mem_event_enable(d, mec, med, mem_access_notification); } break;